<?php
/**
 * Created by PhpStorm.
 * User: zd
 * Date: 17-11-2
 * Time: 下午4:12
 */
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
socket_bind($socket,'0.0.0.0',4481);
socket_listen($socket);

while(1){
    $conn = socket_accept($socket);
//    var_dump($conn);
    $msg = socket_read($conn,1024);
    echo $msg;
    socket_close($conn);
}
socket_close($socket);